package org.geektimes.projects.user.db;

import java.lang.annotation.*;
import java.sql.Connection;

import static java.sql.Connection.TRANSACTION_READ_COMMITTED;

/**
 * @Author: jipeng
 * @Description: 本地事务
 * @Date: Created in 2021/3/11 9:04
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface LocalTransactional {

    int REQUIRED = 0;

    int REQUIRES_NEW = 3;

    int NESTED = 6;

    /**
     * 事务传播
     * @return
     *
     */
    int propagation() default REQUIRED;

    /**
     * 事务隔离级别
     * @return
     * @see Connection#TRANSACTION_READ_COMMITTED
     */
    int  isolation() default TRANSACTION_READ_COMMITTED ;
}
